#define DEBUG
#include <cstdio>
#include <cstring>

using namespace std;

typedef long long ll;
const int mods=100000007, maxn=100, maxk=40, dir[4][2]={{-1, 0}, {0, -1}, {0, 1}, {1, 0}};

void makeMap(int x, int y, int k, int m, int n, bool map[][maxn+1], bool remap[][maxk+2]) {
  x--, y--;
  for (int i=1; i<=k+1; i++) {
    for (int j=1; j<=k+1; j++) {
      remap[i][j] = true;
    }
  }
  for (int i=0; x*i<m && y*i<n; i++) {
    for (int u=1; u<=k+1 && u+x*i<=m; u++) {
      for (int v=1; v<=k+1 && v+y*i<=n; v++) {
        remap[u][v] = remap[u][v]&&map[u+x*i][v+y*i];
      }
    }
  }
}

ll solve(int n, int m, int k, bool map[][maxk+2]) {
  static ll f[maxk+1][maxk+2][maxk+2];
  memset(f, 0, sizeof f);
  if (!map[1][1]) return 0;
  f[0][1][1] = 1;
  for (int i=0; i<k; i++) {
    for (int x=1; x<=k+1; x++) {
      for (int y=1; y<=k+1; y++) {
        if (f[i][x][y] && map[x][y]) {
          for (int j=0; j<4; j++) {
            int nx=x+dir[j][0], ny=y+dir[j][1];
            if (nx>0 && ny>0 && nx<=k+1 && ny<=k+1 && map[nx][ny]) {
              f[i+1][nx][ny] = (f[i+1][nx][ny]+f[i][x][y])%mods;
            }
          }
        }
      }
    }
  }

  ll ret=0;
  for (int i=1; i<=k; i++) {
    ret = (ret+f[i][n][m])%mods;
  }
  return ret;
}

int main() {
#ifdef DEBUG
  freopen("src.in", "r", stdin);
  freopen("src.out", "w", stdout);
#endif

  static bool map[maxn+1][maxn+1], remap[maxk+2][maxk+2];
  int m, n, k;
  scanf("%d %d %d", &m, &n, &k);
  for (int i=1; i<=m; i++) {
    for (int j=1; j<=n; j++) {
      char c;
      scanf(" %c ", &c);
      map[i][j] = c=='.';
    }
  }

  ll ans=0;
  for (int i=1; i<=k+1; i++) {
    for (int j=1; j<=k+1; j++) {
      if (i!=1 || j!=1) {
        makeMap(i, j, k, m, n, map, remap);
        ans = (ans+solve(i, j, k, remap))%mods;
      }
    }
  }
  printf("%lld", ans);

  fclose(stdin);
  fclose(stdout);
  return 0;
}
